home *** CD-ROM | disk | FTP | other *** search
/ PC World Interactive 7 / PC World Interactive 7.iso / program / cprog.EXE / OBJ2ASM.ZIP / OUNEWTRE.C < prev    next >
Text File  |  1991-10-02  |  631b  |  22 lines

  1. #include <stdio.h>
  2. #include "o.h"
  3.  
  4. NODE_T *new_tree( void *data_ptr, int dup_allowed )
  5. {
  6.     NODE_T  *tree;
  7.  
  8.     tree = (NODE_T *)o_malloc(sizeof(NODE_T));
  9.     tree->data          = data_ptr;
  10.     if ( dup_allowed ) {            /* Hide the duplicates allowed indicator */
  11.         tree->balance = LEFT;       /* in the tree root's balance!           */
  12.     } else {
  13.         tree->balance = RIGHT;
  14.     }
  15.     tree->ptr   [LEFT ] = 0;        /* Hide the tree depth in left pointer */
  16.     tree->ptr   [RIGHT] = (NODE_T *)tree;
  17.     tree->thread[LEFT ] = TRUE;
  18.     tree->thread[RIGHT] = TRUE;
  19.     return( tree );
  20. }
  21.  
  22.